package com.atguigu.servlet;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
/*
 HttpServlet extends GenericServlet implements Servlet
 GenericServlet: 不用重写生命周期方法
 HttpServlet:不同的请求方式有不同的请求方案
注意:
   1.使用HttpServlet 重写父类的方法时  必须去掉 super.xxx() 否则报错




 */
public class HpServlet extends HttpServlet {
  /*  @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doGet(req, resp);
    }*/

       @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("HpServlet doGet 请求到达了");
        resp.getWriter().println("HpServlet doGet Response Success ");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("HpServlet doPost 请求到达了");
        resp.getWriter().println("HpServlet doPost Response Success ");
    }

    /*   @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("HpServlet 请求到达了  ");


        resp.getWriter().println("HpServlet HpServlet Success");
    }*/
}
